package beautiful.butterfly.drds.binlog.utils;

import java.util.BitSet;
import java.util.HashMap;


public class StringUtils
{


    public static String union(String database, String table)
    {
        return database + "-" + table;
    }

    public static String[] map(BitSet bitset, HashMap<String, String> map)
    {
        // 截断收尾

        String bitsetStr = bitset.toString();
        bitsetStr = bitsetStr.substring(1, bitsetStr.length() - 1);
        String[] positions = bitsetStr.split(",");
        // 开始构造

        String[] columnNames = new String[positions.length];
        int index = 0;
        for (String position : positions)
        {
            position = position.trim();

            columnNames[index++] = map.get(position);
        }
        return columnNames;
    }

}
